(completion-setup-function): Set default-directory
authorRichard M. Stallman <rms@gnu.org>
Mon, 20 Jan 2003 09:02:28 +0000 (09:02 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 20 Jan 2003 09:02:28 +0000 (09:02 +0000)
in the minibuffer, so it'll be copied into the completion list buffer.

lisp/simple.el

index 39b2631d2b65fa29fa4289d97a5b00294aa901fd..c0028a082334c8697a55c13795722edf9e09cf90 100644 (file)
@@ -3959,7 +3959,14 @@ The completion list buffer is available as the value of `standard-output'.")
 
 (defun completion-setup-function ()
   (save-excursion
-    (let ((mainbuf (current-buffer)))
+    (let ((mainbuf (current-buffer))
+         (mbuf-contents (minibuffer-contents)))
+      ;; When reading a file name in the minibuffer,
+      ;; set default-directory in the minibuffer
+      ;; so it will get copied into the completion list buffer.
+      (if minibuffer-completing-file-name
+         (with-current-buffer mainbuf
+           (setq default-directory (file-name-directory mbuf-contents))))
       (set-buffer standard-output)
       (completion-list-mode)
       (make-local-variable 'completion-reference-buffer)